#include <bits/stdc++.h>

using namespace std;
using ll = long long;

template <typename T>
struct Vector3d
{
    T x, y, z;

    Vector3d() : x(0), y(0), z(0)
    {
    }

    Vector3d(T X, T Y, T Z) : x(X), y(Y), z(Z)
    {
    }

    Vector3d(T X, T Y) : x(X), y(Y), z(0)
    {
    }

    Vector3d operator+(Vector3d v)
    {
        return Vector3d(x + v.x, y + v.y, z + v.z);
    }

    Vector3d operator-(Vector3d v)
    {
        return Vector3d(x - v.x, y - v.y, z - v.z);
    }

    ll operator*(Vector3d v)
    {
        return x * v.x + y * v.y + z * v.z;
    }

    Vector3d operator%(Vector3d v)
    {
        return Vector3d(
            y * v.z - z * v.y,
            z * v.x - x * v.z,
            x * v.y - y * v.x);
    }

    double len()
    {
        return sqrt(x * x + y * y + z * z);
    }
};

// 整型坐标
using Vector3dll = Vector3d<ll>;

// 浮点坐标
using Vector3dd = Vector3d<double>;